﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace Moving03.Services
{
    /// <summary>
    /// Summary description for PhuongThucThanhToan
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class PhuongThucThanhToan : System.Web.Services.WebService
    {

        DataClasses1DataContext context = new DataClasses1DataContext();
        [WebMethod]
        public classPhuongThucThanhToan[] GetPhuongThucThanhToan()
        {
            var query = from tt in context.PhuongThucThanhToans
                        select tt;
            classPhuongThucThanhToan[] arr = new classPhuongThucThanhToan[query.Count()];
            int j = 0;
            foreach (var i in query)
            {
                classPhuongThucThanhToan pttt = new classPhuongThucThanhToan();
                pttt.TenThanhToan = (string)i.TenThanhToan;
                pttt.ID = (int)i.Id_ThanhToan;
                arr[j] = pttt;
                j++;
            }
            return arr;
        }
    }
}
